
德育管理系统

首页
系统管理
系统监控
系统工具
表单构建
代码生成
系统接口
学生管理
班级管理
德育处
年级管理
检查

首页/系统工具/代码生成
首页 宿舍检查 代码生成
表名称
表描述
创建时间
-
11

tb_type

大小类别

TbType

2023-12-26 15:29:04


12

tb_grade

年级

TbGrade

2023-12-26 16:04:21

2023-12-26 16:05:53

13

tb_class

班级

TbClass

2023-12-26 20:54:15

2023-12-26 20:57:24

14

tb_dormitory_inspection

宿舍检查

TbDormitoryInspection

2023-12-27 10:11:04

2023-12-27 10:29:29

共 14 条
前往
页
代码预览
domain.java
mapper.java
service.java
serviceImpl.java
controller.java
mapper.xml
sql
api.js
index.vue
复制

<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="周次" prop="cycle">
        <el-input
          v-model="queryParams.cycle"
          placeholder="请输入周次"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="周几" prop="dayWeek">
        <el-input
          v-model="queryParams.dayWeek"
          placeholder="请输入周几"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="检查人" prop="examiner">
        <el-input
          v-model="queryParams.examiner"
          placeholder="请输入检查人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['examine:inspection:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['examine:inspection:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['examine:inspection:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['examine:inspection:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="inspectionList" :header-cell-style="{ background: '#87ceeb' }"
              border  :row-class-name="tableRowClassName" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column   label="序号"  align="center"  type="index" :index="indexMethod"></el-table-column>
<!--      <el-table-column label="主键" align="center" prop="id" /> -->
      <el-table-column label="周次" align="center" prop="cycle" />
      <el-table-column label="周几" align="center" prop="dayWeek" />
      <el-table-column label="检查人" align="center" prop="examiner" />
      <el-table-column label="被检年级" align="center" prop="gradeName" />
      <el-table-column label="被检班级" align="center" prop="className" />
      <el-table-column label="宿舍类别" align="center" prop="typesQuarters">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.types_quarters_type" :value="scope.row.typesQuarters"/>
        </template>
      </el-table-column>
      <el-table-column label="楼栋" align="center" prop="buildName" />
      <el-table-column label="被检宿舍" align="center" prop="inspectedQuarters" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            type="primary"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['examine:inspection:edit']"
          >修改</el-button>
          <el-button
            type="info"
            @click="handleView(scope.row)"
            v-hasPermi="['examine:inspection:query']"
          >详情</el-button>
          <el-button
            type="danger"
            @click="handleDelete(scope.row)"
            v-hasPermi="['examine:inspection:remove']"
          >删除</el-button>
        </template>
      </el-table-column>

    </el-table>

    <!-- 添加或修改宿舍检查对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="周次" prop="cycle">
          <el-input v-model="form.cycle" placeholder="请输入周次" />
        </el-form-item>
        <el-form-item label="周几" prop="dayWeek">
          <el-input v-model="form.dayWeek" placeholder="请输入周几" />
        </el-form-item>
        <el-form-item label="检查人" prop="examiner">
          <el-input v-model="form.examiner" placeholder="请输入检查人" />
        </el-form-item>
<!--        <el-form-item label="被检年级" prop="gradeId">-->
<!--          <el-input v-model="form.gradeId" placeholder="请输入被检年级" />-->
<!--        </el-form-item>-->
        <el-form-item label="被检年级" prop="gradeId">
          <el-select v-model="form.gradeId" placeholder="请输入被检年级" clearable>
            <!--label这里面的东西才是我们要拿的-->
            <el-option
              v-for="item in GradeList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>

<!--        <el-form-item label="被检班级" prop="classId">-->
<!--          <el-input v-model="form.classId" placeholder="请输入被检班级" />-->
<!--        </el-form-item>-->
        <el-form-item label="被检班级" prop="classId">
          <el-select v-model="form.classId" placeholder="请输入被检班级" clearable>
            <!--label这里面的东西才是我们要拿的-->
            <el-option
              v-for="item in ClassList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>

<!--        <el-form-item label="宿舍类别" prop="typesQuarters">-->
<!--          <el-select v-model="form.typesQuarters" placeholder="请选择宿舍类别(1:男宿舍，2：女宿舍)">-->
<!--            <el-option-->
<!--              v-for="dict in dict.type.types_quarters_type"-->
<!--              :key="dict.value"-->
<!--              :label="dict.label"-->
<!--              :value="dict.value"-->
<!--            ></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->
        <el-form-item label="宿舍类别" prop="typesQuarters">
          <el-radio-group v-model="form.typesQuarters" placeholder="请选择宿舍类别(1:男宿舍，2：女宿舍)">
            <el-radio
              v-for="dict in dict.type.types_quarters_type"
              :key="dict.value"
              :label="dict.value"
            >{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>
<!--        <el-form-item label="楼栋id" prop="buildingId">-->
<!--          <el-input v-model="form.buildingId" placeholder="请输入楼栋id" />-->
<!--        </el-form-item> -->
        <el-form-item label="楼栋" prop="buildingId">
          <el-select v-model="form.buildingId" placeholder="请输入班级" clearable>
            <!--label这里面的东西才是我们要拿的-->
            <el-option
              v-for="item in BuideList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="被检宿舍" prop="inspectedQuarters">
          <el-input v-model="form.inspectedQuarters" placeholder="请输入被检宿舍" />
        </el-form-item>
        <el-form-item label="床号" prop="bedNumberId">
          <el-input v-model="form.bedNumberId" placeholder="请输入床号" />
        </el-form-item>
        <el-form-item label="检查内容" prop="checkContent">
          <el-input v-model="form.checkContent" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="扣分分数" prop="demeritPoint">
          <el-input v-model="form.demeritPoint" placeholder="请输入扣分分数" />
        </el-form-item>
        <el-form-item label="扣分原因" prop="reason">
          <el-input v-model="form.reason" type="textarea" placeholder="请输入内容" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

<!--     查看详情-->
    <el-dialog :title="详情" :visible.sync="open01" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="周次" prop="cycle">
          <el-input v-model="form.cycle" placeholder="请输入周次" :disabled="true" />
        </el-form-item>
        <el-form-item label="周几" prop="dayWeek">
          <el-input v-model="form.dayWeek" placeholder="请输入周几" :disabled="true" />
        </el-form-item>
        <el-form-item label="检查人" prop="examiner">
          <el-input v-model="form.examiner" placeholder="请输入检查人"  :disabled="true" />
        </el-form-item>
<!--        <el-form-item label="被检年级" prop="gradeId">-->
<!--          <el-input v-model="form.gradeId" placeholder="请输入被检年级"   :disabled="true"/>-->
<!--        </el-form-item>-->
        <el-form-item label="被检年级" prop="gradeId">
          <el-select v-model="form.gradeId" placeholder="请输入被检年级" clearable  :disabled="true">
            <!--label这里面的东西才是我们要拿的-->
            <el-option
              v-for="item in GradeList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>

<!--        <el-form-item label="被检班级" prop="classId">-->
<!--          <el-input v-model="form.classId" placeholder="请输入被检班级"  :disabled="true" />-->
<!--        </el-form-item>-->
<!--        <el-form-item label="宿舍类别" prop="typesQuarters">-->
<!--          <el-select v-model="form.typesQuarters" placeholder="请选择宿舍类别(1:男宿舍，2：女宿舍)"  :disabled="true">-->
<!--            <el-option-->
<!--              v-for="dict in dict.type.types_quarters_type"-->
<!--              :key="dict.value"-->
<!--              :label="dict.label"-->
<!--              :value="dict.value"-->
<!--            ></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->

        <el-form-item label="宿舍类别" prop="typesQuarters">
          <el-radio-group v-model="form.typesQuarters" placeholder="请选择宿舍类别(1:男宿舍，2：女宿舍)"  clearable  :disabled="true">
            <el-radio
              v-for="dict in dict.type.types_quarters_type"
              :key="dict.value"
              :label="dict.value"
            >{{dict.label}}</el-radio>
          </el-radio-group>
        </el-form-item>

<!--        <el-form-item label="楼栋id" prop="buildingId">-->
<!--          <el-input v-model="form.buildingId" placeholder="请输入楼栋id"  :disabled="true" />-->
<!--        </el-form-item>-->

        <el-form-item label="楼栋" prop="buildingId">
          <el-select v-model="form.buildingId" placeholder="请输入班级" clearable  :disabled="true">
            <!--label这里面的东西才是我们要拿的-->
            <el-option
              v-for="item in BuideList"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            ></el-option>
          </el-select>
        </el-form-item>

        <el-form-item label="被检宿舍" prop="inspectedQuarters">
          <el-input v-model="form.inspectedQuarters" placeholder="请输入被检宿舍"  :disabled="true" />
        </el-form-item>
        <el-form-item label="床号" prop="bedNumberId">
          <el-input v-model="form.bedNumberId" placeholder="请输入床号" :disabled="true" />
        </el-form-item>
        <el-form-item label="检查内容" prop="checkContent">
          <el-input v-model="form.checkContent" type="textarea" placeholder="请输入内容"  :disabled="true" />
        </el-form-item>
        <el-form-item label="扣分分数" prop="demeritPoint">
          <el-input v-model="form.demeritPoint" placeholder="请输入扣分分数"  :disabled="true" />
        </el-form-item>
        <el-form-item label="扣分原因" prop="reason">
          <el-input v-model="form.reason" type="textarea" placeholder="请输入内容"   :disabled="true"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="open01 = false">关 闭</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listInspection, getInspection, delInspection, addInspection, updateInspection } from "@/api/examine/inspection";
import {listGrade} from "@/api/garde/grade";
import {listClass} from "@/api/class_management/class";
import {listBuilding} from "@/api/dormitory/building";

export default {
  name: "Inspection",
  dicts: ['types_quarters_type'],
  data() {
    return {
      // 楼栋
      BuideList: [],
      // 班级
      ClassList: [],
      // 年级
      GradeList: [],
      open01: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 宿舍检查表格数据
      inspectionList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        cycle: null,
        dayWeek: null,
        examiner: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        cycle: [
          { required: true, message: "周次不能为空", trigger: "blur" }
        ],
        dayWeek: [
          { required: true, message: "周几不能为空", trigger: "blur" }
        ],
        examiner: [
          { required: true, message: "检查人不能为空", trigger: "blur" }
        ],
        gradeId: [
          { required: true, message: "被检年级不能为空", trigger: "blur" }
        ],
        classId: [
          { required: true, message: "被检班级不能为空", trigger: "blur" }
        ],
        typesQuarters: [
          { required: true, message: "宿舍类别(1:男宿舍，2：女宿舍)不能为空", trigger: "change" }
        ],
        buildingId: [
          { required: true, message: "楼栋id不能为空", trigger: "blur" }
        ],
        inspectedQuarters: [
          { required: true, message: "被检宿舍不能为空", trigger: "blur" }
        ],
        bedNumberId: [
          { required: true, message: "床号不能为空", trigger: "blur" }
        ],
        checkContent: [
          { required: true, message: "检查内容不能为空", trigger: "blur" }
        ],
        demeritPoint: [
          { required: true, message: "扣分分数不能为空", trigger: "blur" }
        ],
        reason: [
          { required: true, message: "扣分原因不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
    this.getClassList();
    this.getGradeList();
    this.getBuideList();
  },
  methods: {
    // 楼栋
    getBuideList() {
      listBuilding().then(response => {
        this.BuideList = response.rows;
      });
    },
    // 年级
    getGradeList() {
      listGrade().then(response => {
        this.GradeList = response.rows;
      });
    },
    // 班级
    getClassList() {
      listClass().then(response => {
        this.ClassList = response.rows;
      });
    },

    // 查看详情
    handleView(row){
      this.open01 = true;
      this.form = row;
    },
    // 序号
    indexMethod(index) {
      return (this.queryParams.pageNum - 1)*this.queryParams.pageSize + index + 1;
    },
    // 表格颜色
    tableRowClassName({row, rowIndex}) {
      if (rowIndex % 2 === 0) {
        return 'success-row';
      } else {
        return 'warning-row';
      }
    },
    handleDetail(row) {
      // this.opne01 = true;
      getInspection(row.id).then(response => {
           this.handleDetailList = response.data;
        console.log(this.handleDetailList);
      })
    },
    /** 查询宿舍检查列表 */
    getList() {
      this.loading = true;
      listInspection(this.queryParams).then(response => {
        this.inspectionList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        cycle: null,
        dayWeek: null,
        examiner: null,
        gradeId: null,
        classId: null,
        typesQuarters: null,
        buildingId: null,
        inspectedQuarters: null,
        bedNumberId: null,
        checkContent: null,
        demeritPoint: null,
        reason: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加宿舍检查";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getInspection(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改宿舍检查";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateInspection(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addInspection(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除宿舍检查编号为"' + ids + '"的数据项？').then(function() {
        return delInspection(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('examine/inspection/export', {
        ...this.queryParams
      }, `inspection_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>


<style>
.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}
</style>
